Blueprint Help Send comments on this topic.
Routing Events

Glossary Item Box

Overview

It is often desirable to send an input event in one of many directions but using a method for routing involves consuming the event and reproducing it.  This results in unnecessary data copying and the complexity of rebuilding the event (especially awkward if it is a complex compound event).  Event routing provides a mechanism by which events can be switched between multiple consumers without requiring active objects or data copying.

How is Event Routing Supported by CLIP?

CLIP provides an object called a Logical Semaphore that can be used combination with collector to provide event routing behavior:

The resource underlying a logical semaphore is a single value that can be updated to a new value or requested.  When requesting, the value can be compared using a particular comparator and value.

By combining logical semaphores with sequential collectors, an event can be switched on or off passively.  The logical semaphore must be collected first before the input event can be collected.  This means that the input event is not consumed until the logical semaphore enters a predetermined state:

This example shows a very simple 'switch' that routes its input to one of 'N' output channels.  The channel is selected by the value in the 'Lsm' logical semaphore and the selection will 'persist' until the value in the semaphore changes. 

Each element of the collector connects to the semaphore with a different key, but each connection uses the CLP_EQ_RULE rule.  This means that only collector element 'n', where 'n' matches the semaphore value, can progress its collection, and so the event will be routed along that channel.

A splitter is included in order to hide the internal logic from the output event consumer - the consumer wants to retrieve the same event that was input without the extra collector and semaphore included.  For more information on this mechanism, see Switching.